package com.loooooo.pm2024.exception;

public class MyBaseException extends RuntimeException {

    private String type;
    private String message;
    private int status = 500;
    private boolean json;
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    public MyBaseException() {
    }

    public MyBaseException(int status) {
        this.status = status;
    }

    public MyBaseException(Exception e) {
        super(e);
        this.message = e.getMessage();
    }

    public MyBaseException(Exception e, int status) {
        super(e);
        this.message = e.getMessage();
        this.status = status;
    }

    public MyBaseException(String message) {
        super(message);
        this.message = message;
    }

    public MyBaseException(String message, int status) {
        super(message);
        this.message = message;
        this.status = status;
    }

    public MyBaseException(String message, int status, boolean json) {
        super(message);
        this.message = message;
        this.status = status;
        this.json = json;
    }

    public MyBaseException(String message, String type) {
        super(message);
        this.type = type;
        this.message = message;
    }

    public MyBaseException(String message, String type, int status) {
        super(message);
        this.type = type;
        this.message = message;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public static void throwMe(int status, String message) {
        throw new MyBaseException(message, status);
    }

    public static void throwMe(int status, String message, boolean json) {
        throw new MyBaseException(message, status, json);
    }

    public boolean isJson() {
        return json;
    }

    public void setJson(boolean json) {
        this.json = json;
    }
}
